<?php 
if(isset($_SESSION[ "label"		])){
	$labels=$_SESSION[ "label"		];
}else{
	$labels=array	(
					"bnone"=>"none",
					"bred"=>"red",
					"bblue"=>"blue",
					"bgreen"=>"green",
					"bpurple"=>"purple",
					);
}
?>
<style>
.general_form .inputs {
float: right;
width: 560px;
}
.general_form label{
	width:200px;
}
</style>
<div class="title_wrapper">
	<h2>Main Section Title</h2>
	<a href="#"><span>Open Site</span></a>
</div>
<!--[if !IE]>start section<![endif]-->
<div class="section">
	
	<h3>Setting</h3>
	
	<!--[if !IE]>start section content<![endif]-->
	<div class="section_content">
		
		<div class="tabs">
			<ul>
				<li><a href="#" class="active"><span><span>All Setting</span></span></a></li>
				<li><a href="#"><span><span>System</span></span></a></li>
				<li><a href="#"><span><span>Account</span></span></a></li>
				<li><a href="#"><span><span>Display</span></span></a></li>
				<li><a href="#"><span><span>Error message</span></span></a></li>
			</ul>
		</div>
		
		
		<?php 
		$admin_author = 	strpos($_SESSION[ "account_authorityniv"],$authoritys["admin"]) ;
		$contact_author=	strpos($_SESSION[ "account_authorityniv"],$authoritys["contact"]);
		if($admin_author===FALSE && $contac_author===False){
			echo "Please, Login with Admin aothority.";
		}else{
		?>
<table>
	<tr>
		<th style="width:120px;text-align:left;">System Setting</th>
		<td>
		</td>
	</tr>
	<tr>
		<td></td>
		<td>
			...		
		</td>
	</tr>
	<tr>
		<th style="text-align:left;">Display Setting</th>
		<td></td>
	</tr>
	<tr>
		<td></td>
		<td>
			<form action="#" class="search_form general_form">
		<!--[if !IE]>start fieldset<![endif]-->
			<fieldset>
				<!--[if !IE]>start forms<![endif]-->
				<div class="forms">
				
				
				
				<!--[if !IE]>start row<![endif]-->
				<div class="row">
					<label>Number of row in pages :</label>
					<div class="inputs">
						<span class="input_wrapper"><input class="text" id="txtnumrow" name="" type="text" value="<?=isset($_SESSION[ "numrow"		])?$_SESSION[ "numrow"		]:10?>"/></span>
					</div>
				</div>
				<!--[if !IE]>end row<![endif]-->
				
				
				
				</div>
				<!--[if !IE]>end forms<![endif]-->
				
			</fieldset>
			<!--[if !IE]>end fieldset<![endif]-->
			
			
			
			
			</form>
		</td>
	</tr>
	<tr>
		<th style="text-align:left;">Contact Setting(by Admin)</th>
		<td></td>
		
	</tr>
	<tr>
		<td></td>
		<td>
			<form action="#" class="search_form general_form">
		<!--[if !IE]>start fieldset<![endif]-->
			<fieldset>
				<!--[if !IE]>start forms<![endif]-->
				<div class="forms">
				
				
				
				<!--[if !IE]>start row<![endif]-->
				<div class="row">
					<label>None label :</label>
					<div class="inputs">
						<span class="input_wrapper"><input class="text" id="txtbnone" name="" type="text" value="<?=$labels["bnone"]?>"/></span>
						<div class="change label bnone"><div class=""></div></div>
					</div>
				</div>
				<div class="row">
					<label>Red label :</label>
					<div class="inputs">
						<span class="input_wrapper"><input id="txtbred" class="text" name="" type="text" value="<?=$labels["bred"]?>"/></span>
						<div class="change label bred"><div class=""></div></div>
					</div>
				</div>
				<div class="row">
					<label>Blue label :</label>
					<div class="inputs">
						<span class="input_wrapper"><input id="txtbblue" class="text" name="" type="text" value="<?=$labels["bblue"]?>"/></span>
						<div class="change label bblue"><div class=""></div></div>
					</div>
				</div>
				<div class="row">
					<label>Green label :</label>
					<div class="inputs">
						<span class="input_wrapper"><input id="txtbgreen" class="text" name="" type="text" value="<?=$labels["bgreen"]?>"/></span>
						<div class="change label bgreen"><div class=""></div></div>
					</div>
				</div>
				<!--[if !IE]>end row<![endif]-->
				
				<!--[if !IE]>start row<![endif]-->
				<div class="row">
					<label>Purble label:</label>
					<div class="inputs">
						<span class="input_wrapper"><input id="txtbpurple" class="text" name="" type="text" value="<?=$labels["bpurple"]?>"/></span>
						<div class="change label bpurple"><div class=""></div></div>
					</div>
				</div>
				
				<!--[if !IE]>start row<![endif]-->
				<div class="row">
					<div class="buttons">
						
						
						<ul>
							<li><span class="button first_btn"><span><span>Save</span></span><input name="btnsave" id="btnsave" type="button"></span></li>
						</ul>
						
						<ul class="right">
							<li><span class="button contrast_btn"><span><span>Bright button</span></span><input name="" type="submit"></span></li>
						</ul>
					</div>
				</div>
				<!--[if !IE]>end row<![endif]-->
				
				
				
				</div>
				<!--[if !IE]>end forms<![endif]-->
				
			</fieldset>
			<!--[if !IE]>end fieldset<![endif]-->
			
			
			
			
			</form>
			
		</td>
	</tr>
</table>
			<ul class="system_messages" style="display:none;" id="settingerror">
				<li class="red" id="msgct"></li>
			</ul>
		<script type="text/javascript">
			$("#btnsave").click(
				function(){
					var surl="../Controller/Navigation.php";
					var sdata={
						"controller":"SYSController",
						"action":"saveSetting",
						"bnone": $("#txtbnone").val(),
						"bred": $("#txtbred").val(),
						"bblue": $("#txtbblue").val(),
						"bgreen": $("#txtbgreen").val(),
						"bpurble": $("#txtbpurple").val(),
						"rowdisplay": $("#txtnumrow").val()
						
					};
					jQuery.ajax({
						type:"POST", 
						data:sdata, 
						dataType:"text", 
						url:surl, 
						success: function (data){ 
						$("#settingerror").show();
						$("#msgct").html(data);
						},
						error: function (xhr, ajaxOptions, thrownError){
							$("#settingerror").show();
							$("#msgct").html("<b>Status</b>:"+xhr.status+"<br/><b>ThrownError</b>:"+thrownError);
							//
						}
					});	
					
				}
			);
		</script>
		
		
			
		<?php 
		}
		?>
			
	</div>
	<!--[if !IE]>end section content<![endif]-->
</div>
<!--[if !IE]>end section<![endif]-->